package org.jeecg.modules.demo.yhs.Service;

import org.jeecg.modules.demo.yhs.mapper.ProportionMapper;
import org.jeecg.modules.demo.yhs.POJO.Count;
import org.jeecg.modules.demo.yhs.POJO.Proportion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProportionServiceImpl implements ProportionService {
    @Autowired
    ProportionMapper proportionMapper;
    public Proportion findAll() {
        Proportion proportion=new Proportion();
        Count count=proportionMapper.find();
        int allmoney=count.getMoney();
        int allnum=count.getNum();
        proportion.setAll(allmoney/allnum);
        count=proportionMapper.findBySex("男");
        proportion.setMan(count.getMoney()/allnum);
        count=proportionMapper.findBySex("女");
        System.out.println(count.toString());
        proportion.setWoman(count.getMoney()/allnum);
        return proportion;
    }
}
